package com.scau.hwadee.examination.controller;

import com.scau.hwadee.examination.service.SchoolService;
import com.scau.hwadee.examination.vo.ResponseVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

/**
 * @author YHX
 * @date 2019/7/31 16:09
 * description
 */
@Slf4j
@Controller
@RequestMapping("school")
@Api(tags = "SchoolController",description = "学校相关操作模块")
public class SchoolController {

    @Autowired
    private SchoolService schoolService;

    @GetMapping("allSchools")
    @ApiOperation(value = "获取所有的学校信息")
    public ResponseEntity<ResponseVo> getAllSchools(@RequestParam("pageNum")int pageNum,
                                                    @RequestParam("pageSize") int pageSize){
        ResponseVo vo=ResponseVo.instance();
        vo.setData(schoolService.getAllSchools(pageNum,pageSize));
        return new ResponseEntity<>(vo, HttpStatus.OK);
    }



}
